const { defineConfig } = require('@vue/cli-service')
const path = require('path')
const defaultSettings = require('./src/config/settings')

function resolve(dir) {
  return path.join(__dirname, dir)
}
const name = defaultSettings.title || 'vue Admin Template'
module.exports = defineConfig({
  transpileDependencies: true,
  configureWebpack: {
    name,
    resolve: {
      alias: {
        '@': resolve('src')
      }
    }
  },

  devServer: {
    host: '127.0.0.1',
    hot: true,
    port: 8081,
    open: true,
    compress: true,
    proxy: {
      [process.env.VUE_APP_BASE_API]: {
        target: process.env.VUE_APP_SERVE,
        changeOrigin: true,
        pathRewrite: {
          [`^${process.env.VUE_APP_BASE_API}`]: ''
        }
      }
    }
  }
})
